export const checkemoji = (str) => {
      var reg = RegExp(/[\ud800-\udbff][\udc00-\udfff]/g);
      return reg.test(str)
}
export const checkTime = (str) => {
      var reg = RegExp(/^\d+(\.\d{0,2})?$/g);
      return reg.test(str)
}
const checkAddZone=(num)=>{
      return num<10 ? '0' + num.toString() : num
}
export const toDate=(t)=>{
      if (!t) return ''
     wx.getSystemInfo({
     success: function (res) {
      if (res.platform == "ios") {
        t=t.replace(/-/g,"/")

      }
    }
  })
      t = new Date(t).getTime()
      t = new Date(t)
      var year = t.getFullYear()
      var month = (t.getMonth() + 1)
      month = checkAddZone(month)
     
      var date = t.getDate()
      date = checkAddZone(date)
     
      var hour = t.getHours()
      hour = checkAddZone(hour)
     
      var min = t.getMinutes()
      min = checkAddZone(min)
     
      var se = t.getSeconds()
      se = checkAddZone(se)
     
      return year + '-' + month + '-' + date + ' ' + hour + ':' + min + ':' + se
    }
export const timeStamp = (StatusMinute) => {
      var hour = parseInt(StatusMinute / 60 % 24);
      var min = parseInt(StatusMinute % 60);
      StatusMinute = "";
      if (hour > 0) {
            StatusMinute += hour + "小时";
      }
  if (hour == 0 || min > 0) {
            StatusMinute += parseFloat(min) + "分钟";
      }
      return StatusMinute;
}
export const charCodeAt = (str) => {
      var res = [];
      for (var i = 0; i < str.length; i++)
            res[i] = ("00" + str.charCodeAt(i).toString(16)).slice(-4);
      return "\\u" + res.join("\\u");
}
export const checkIdCard = (str) => {
      var reg = RegExp(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/g)
      return reg.test(str)
}
export const checkPhone = (str) => {
      var reg = RegExp(/^1[345789]\d{9}$/g);
      return reg.test(str)
}
export const checkWx = (str) => {
      var reg = RegExp(/^([-_a-zA-Z0-9]{5,19})+$/g)
      return reg.test(str)
}
export const minuteToHour = (str) => {
      var hour = parseInt(str / 60)
      var minute = str % 60
      return hour == 0 && minute != 0 ? minute + '分' : (hour != 0 && minute == 0 ? hour + '小时' : (hour != 0 && minute != 0 ? hour + '小时' + minute + '分' : 0))
}
export const fomatTime = (str) => {
      var year = str.substring(0, 4)
      var month = str.substring(4, 6)
      var day = str.substring(6, 8)
      var hour = str.substring(8, 10)
      var minute = str.substring(10, 12)
      return year + '/' + month + '/' + day + ' ' + hour + ':' + minute
}
export const idcardReg = /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/;